#!/bin/sh

prepare_go_dir() {
    (
        cd $1
        rm -f go.sum
        go mod tidy
    )
}

echo "ShellHub release script"

go_dirs=$(git ls-files | grep 'go.mod' | xargs dirname)

basedir=$(dirname $(readlink -f $0))/..
cd $basedir

echo "Running Go related tasks"
for d in $go_dirs; do
    prepare_go_dir $d
done

prepare_go_dir .
